\documentclass[a4paper,9pt]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[margin=2.5cm]{geometry} %layout
\usepackage{hyperref}   % links im text
\usepackage{color}
\usepackage{framed}
\usepackage{enumerate}  % for advanced numbering of lists
\clubpenalty  = 10000   % Schusterjungen verhindern
\widowpenalty = 10000   % Hurenkinder verhindern

\hypersetup{
  pdfauthor   = {Martin Thoma},
  pdfkeywords = {Lineare Algebra},
  pdftitle    = {Lineare Algebra}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Custom definition style, by                                       %
% http://mathoverflow.net/questions/46583/what-is-a-satisfactory-way-to-format-definitions-in-latex/58164#58164
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newdimen\errorsize \errorsize=0.2pt
% Frame with a label at top
\newcommand\LabFrame[2]{%
    \fboxrule=\FrameRule
    \fboxsep=-\errorsize
    \textcolor{FrameColor}{%
    \fbox{%
      \vbox{\nobreak
      \advance\FrameSep\errorsize
      \begingroup
        \advance\baselineskip\FrameSep
        \hrule height \baselineskip
        \nobreak
        \vskip-\baselineskip
      \endgroup
      \vskip 0.5\FrameSep
      \hbox{\hskip\FrameSep \strut
        \textcolor{TitleColor}{\textbf{#1}}}%
      \nobreak \nointerlineskip
      \vskip 1.3\FrameSep
      \hbox{\hskip\FrameSep
        {\normalcolor#2}%
        \hskip\FrameSep}%
      \vskip\FrameSep
    }}%
}}
\definecolor{FrameColor}{rgb}{0.25,0.25,1.0}
\definecolor{TitleColor}{rgb}{1.0,1.0,1.0}

\newenvironment{contlabelframe}[2][\Frame@Lab\ (cont.)]{%
  % Optional continuation label defaults to the first label plus
  \def\Frame@Lab{#2}%
  \def\FrameCommand{\LabFrame{#2}}%
  \def\FirstFrameCommand{\LabFrame{#2}}%
  \def\MidFrameCommand{\LabFrame{#1}}%
  \def\LastFrameCommand{\LabFrame{#1}}%
  \MakeFramed{\advance\hsize-\width \FrameRestore}
}{\endMakeFramed}
\newcounter{definition}
\newenvironment{definition}[1]{%
  \par
  \refstepcounter{definition}%
  \begin{contlabelframe}{Definition \thedefinition:\quad #1}
 \noindent\ignorespaces}
{\end{contlabelframe}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin document                                                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quam elit, vestibulum nec facilisis at, condimentum id enim. Sed iaculis lacinia quam, vel accumsan eros tempor in. Integer ipsum metus, accumsan sit amet commodo a, egestas vitae sem. Mauris ut orci ut dolor viverra convallis nec a erat. Aenean consequat elit vel eros fermentum vestibulum id at ipsum. In vitae orci mauris, et rhoncus odio. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Fusce libero nulla, euismod vel suscipit nec, elementum vel massa. Mauris ut sapien sed neque dignissim sodales. Proin accumsan, lectus non gravida dapibus, lorem leo tincidunt odio, in semper ligula libero bibendum lorem. Pellentesque venenatis massa a neque porttitor congue. Maecenas ornare lacus ac orci mattis a placerat sapien euismod. In sed eros enim, non interdum nisi. Curabitur quis magna et tortor interdum pharetra. Donec sit amet turpis neque, quis congue leo. Proin sit amet placerat dolor.

 \begin{definition}[adsf]
asdfasdfasdf\\
asdf
 \end{definition}

Vivamus ante est, dictum at placerat id, semper auctor tellus. Donec sed ipsum enim, eget lacinia mi. Duis vulputate auctor ligula, sit amet suscipit lectus malesuada ut. Donec adipiscing rutrum dolor sit amet euismod. Aenean condimentum nibh vitae neque rhoncus ultrices. Vestibulum ultrices commodo mattis. Morbi aliquam elementum est, a pulvinar arcu viverra quis. Vivamus sed fermentum nisl. Cras bibendum, justo tincidunt dictum venenatis, sem turpis vestibulum nibh, ut dapibus nunc enim ut justo. Nullam iaculis vulputate aliquam. Sed nulla metus, facilisis eu porta sed, aliquet id mi. Duis congue blandit quam, a auctor turpis rhoncus non. Nam id dictum nibh. Integer vitae lacus sit amet ipsum semper interdum nec eget nisl. Vivamus aliquet, augue ut ultrices auctor, neque lacus vestibulum leo, vel dapibus ligula nisi ac nibh. Etiam accumsan, felis ut dapibus sagittis, velit turpis pellentesque nibh, nec cursus libero erat at odio.

\begin{definition}{Quadratic Equation}
A Quadratic Equation is an equation in the form:
\begin{equation}
ax^2+bx+c=0
\end{equation}
where \(a,b,c\in\mathbb{R}\).
\end{definition}

Fusce commodo erat et eros tincidunt quis elementum dui tincidunt. Sed blandit elementum eros nec pulvinar. Aenean vitae dignissim est. Sed auctor porttitor tempor. Donec id euismod diam. Aenean vulputate hendrerit metus sit amet aliquet. Curabitur ac pretium lacus. Ut tempus, augue vitae tristique laoreet, lacus lorem ultrices libero, et pretium sapien leo facilisis massa. Nunc pretium lorem eget libero hendrerit in pretium sapien convallis. Ut molestie, mi eget accumsan laoreet, lacus urna scelerisque metus, et luctus erat arcu non ante. Donec sit amet nisi felis, a interdum nibh.

Pellentesque commodo, nisi nec feugiat vehicula, augue erat convallis ipsum, adipiscing cursus purus dolor venenatis velit. Vivamus enim augue, lacinia in ultrices a, varius sit amet sapien. Aliquam enim velit, molestie vitae bibendum eget, laoreet at ante. Suspendisse pulvinar leo at nisi accumsan nec malesuada neque ullamcorper. Aenean quis mi lectus, quis porttitor nisi. Curabitur interdum luctus lectus et egestas. Aenean sapien ligula, aliquam sed fermentum id, blandit at orci. Integer a turpis ac tellus commodo suscipit. Vivamus massa orci, pharetra eu consequat eu, vulputate eget lacus. Suspendisse non justo arcu. Nullam lacus augue, dapibus vitae convallis a, consectetur at elit.
\end{document}
